<%@ page language="java" contentType="text/html; charset=UTF-8"  import="java.util.*,SiTuQingYou.vo.*,SiTuQingYou.vo.*"
    pageEncoding="UTF-8"   %>
<%   
String path = request.getContextPath();
%>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="<%=path%>/houtai/res/css/amazeui.min.css" />
		<link rel="stylesheet" href="<%=path%>/houtai/res/css/admin.css" />
		<style type="text/css">
		img{
		width:100px;
		height:90px;
		}
		table{
		margin:10px;
		padding: 10px;
		
		}
		td{
		background-color:#00FFFF;
		border:0px solid  gray;
		margin:10px;
		padding:10px;
		width:100px;
		
		}
		#tro1{
		width:600px;
		height:40px;
		}
		.cottt{
		display:-webkit-box;
		-webkit-box-orient:vertical;
		-webkit-line-clamp:1;
		overflow:hidden;
		text-overflow:ellipsis;
		} 
		.page{
		text-align: center;
		maigin-top:50px;
		}
		.page a,.page span{
		text-decoration: none;
		border:1px solid #f9d52b;
		padding:5px 7px;
		color:#767675;
		cursor:pointer;
		}
		.page a:hover,.page span:hover{
		background-color: red;
		}
		 .aa{display:inline-block; width:40px;height:40px;background-color:lightgray;text-align:center;line-height:40px;border-radius:18px;text-decoration:none;margin-top:10px;}
	    a.cur{background-color:#E0FFFF;}
		</style>
	</head>
	<body>
						<jsp:include page="../StrategyServlet">
						<jsp:param value="getAllStrategys" name="method"/>
						</jsp:include>
		<div class="admin-content-body">
			<div class="am-cf am-padding am-padding-bottom-0">
				<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">攻略管理</strong><small></small></div>
			</div>
			<hr>
			

			<div class="am-g">
				<div class="am-u-sm-12 am-u-md-6">
					<div class="am-btn-toolbar">
						<div class="am-btn-group am-btn-group-xs">
							<a id="daish"> 待审核攻略(<span id="abnum"><%=request.getAttribute("abnum")%></span>)</a>
						    
						</div>
					</div>
				</div>
				<div class="am-u-sm-12 am-u-md-3">

				</div>
				<div class="am-u-sm-12 am-u-md-3">
					<div class="am-input-group am-input-group-sm">
           				 <form  method="post" action="<%=path%>/houtai/checkstra.jsp">
						       <input type="text" name="key" >
						        <input type="submit" value="搜索">
						       </form>  
					</div>
				</div>
			</div>
			<div class="am-g">
				<div class="am-u-sm-12">
					<form class="am-form">
						
					<table>
					<tr>
					<td>攻略图片</td>
					<td>攻略名称</td>
					<td  id="tro1">攻略内容</td>
					<td>攻略作者</td>
					<td>点赞</td>
					<td>收藏</td>
					<td>评论</td>
					<td>删除</td>
						</tr>
					
						 <% 
					Integer datacount = (Integer)request.getAttribute("datacount");
		        	int pagecount = datacount/5+(datacount%5==0?0:1); 
 					ArrayList<Strategy> strategy = (ArrayList<Strategy>)request.getAttribute("strategys"); 
                     for(Strategy str:strategy){   %>
                  <tr>   <td><img src="<%=path%>/imagess/<%=str.getPhoto()%>"</td>
                     <td><%=str.getTitle()%></td>
                     <td><div class="cottt"> <%=str.getContent()%></div></td>
                     <td><%=str.getUser().getUsernickname()%></td>
                     <jsp:include page="../StrategyServlet">
						<jsp:param value="alllike" name="method"/>
						<jsp:param value="<%=str.getId()%>" name="lovenum"/>
						</jsp:include>
						<%
            Integer likenum = (Integer)request.getAttribute("likenum");
			Integer collectnum = (Integer)request.getAttribute("collectnum");
%>
                     <td><%=likenum%></td>
                     <td><%=collectnum%></td>
                     <td><a id="comment"  cid="<%=str.getId()%>"  class="aa" href="javascript:void(0);">查</a></td>
            		<td><input   cid="<%=str.getId()%>" type="button" id="delete" value="删除"></td>
            		</tr>
  <% }
 %>
					</table>
					<div  class="page">
					<span>上一页</span>
					<%
					for(int i=1;i<=pagecount;i++){  
				%>
				
				 <a   href="<%=path%>/houtai/user.jsp?pagenum=<%=i%>"><%=i%></a>
				<%
					}
					%>		
					<span>下一页</span>					 
					</div>
					</form>
				</div>
			</div>
		</div>
			<script src="js/jquery-1.11.3.min.js"></script>
		<!--<![endif]-->
		<script type="text/javascript" src="myplugs/js/plugs.js"></script>
		<script > 
		$(document).ready(function(){
			$("input[id=delete]").click(function(){ 
			var  cid = $(this).attr("cid");
			var thiss = $(this);
			$.ajax({
				url:"<%=path %>/StrategyServlet",
     			type:"post",
     			data:"method=deleteone&cid="+cid,
     			success:function(mes){
     				thiss.parent().parent().remove();
   			}
     		});
		});
	});
		</script>
		<script>
			$("#daish").click(function() {
				$.jq_Panel({
					title: "待审核列表",
					iframeWidth: 900,
					iframeHeight: 350,
					url: "daish.jsp",
				});
			});
			</script>
			<script>
			$("a[id=comment]").click(function() {
				var cid = $(this).attr("cid");
				$.jq_Panel({
					title: "评论",
					iframeWidth: 600,
					iframeHeight: 300,
					url: "<%=path%>/StrategyServlet?method=allcomment&cid="+cid,
				});
			});
			</script>
	</body>
</html>
 